<?
$answers = $this->answers;
$name = $this->name;
$id = $this->id;

?>
<p> <?= $name ?> </p>
<table class="table4admin">
    <thead>
    <tr>
        <td>Question</td>
        <td>Count votes</td>
        <td>Created at</td>
        <td>Updated at</td>
        <td></td>
        <td></td>
    </tr>
    </thead>

    <tbody>
    <? foreach ($answers as $answer): ?>
    <tr>

        <td><?= $answer['name'] ?></td>
        <td><?= $answer['votesCount'] ?></td>
        <td><?= $answer['createdAt']->format('Y-m-d') ?></td>
        <td><?= $answer['updatedAt']->format('Y-m-d') ?></td>
        <td><a href="/pollvotinghistory/edit/ans_id/<?= $answer['id'] ?>">Edit</a></td>
        <td><a href="/pollvotinghistory/delete/ans_id/<?= $answer['id'] ?>" class="delete">Delete</a></td>
    </tr>
        <? endforeach; ?>
    </tbody>
</table>

<a id ="add_answer_button" href="">Add answer</a>


    <form id="form2" method="post" style="display:none;">

    <input style="width:400px" id = "answer_1" name="answer[]" /><br>
    <input id="add_answer" type="button" value="Add answer" />
    <br>
    <input id="addanswer" type="submit" value="Add" />
    </form>

<script type="text/javascript">
    $('#add_answer_button').live('click', function() {
        $('#form2').toggle();
        return false;
    });

</script>